import {createRouter,createWebHistory,RouteRecordRaw} from "vue-router"
import Login from "../views/Login.vue"
import Register from "../views/Register.vue"
import Home from "../views/Home.vue"
import User from "@/views/system/User.vue"
import Role from "@/views/system/Role.vue"
import NotFind from "@/views/NotFind.vue"
import Main from "@/views/main/Main.vue"


const routes:Array<RouteRecordRaw> = [
    {path:"/login",component:Login,meta:{cache:false}},
    {path:"/reg",component:Register,meta:{cache:false}},
    {path:"/",component:Home,meta:{cache:false},
        children:[
            {path:"home",component:Main,meta:{cache:false}},
            {path:"system/user",component:User,meta:{cache:true}},
            {path:"system/role",component:Role,meta:{cache:false}}
        ],
    },
    {path:"/:pathMatch(.*)",redirect:"/404",meta:{cache:false}},
    {path:"/404",component:NotFind,meta:{cache:false}}
]

//创建一个路由对象
const router = createRouter({
    routes,
    history:createWebHistory()
})

export default router

